#ifndef FRODOII_H
#define FRODOII_H

#include <stdint.h>

#define BLOCK_SIZE		0x10000
#define MAX_KERNEL_LEN		(0x1a0000-0x2000)
#define MAX_ROOTFS_LEN		(0x7d0000-0x1a0000)
//the string is "0x55 0xaa FrodoII 0x00 0x55 0xaa"
uint8_t FRODOII_MAGIC[] = {
	0x55, 0xaa, 0x46, 0x72, 0x6f, 0x64, 0x6f, 0x49, 0x49, 0x00, 0x55, 0xaa
};

// little-endian
typedef struct FRODOII_CONTROL_HEADER_ {
  uint32_t kernel_offs;
  uint32_t kernel_len;
  uint32_t rootfs_offs;
  uint32_t rootfs_len;
  uint32_t settings_offs;
  uint32_t settings_len;
  uint32_t kernel_csum;
  uint32_t rootfs_csum;
  uint32_t settings_csum;
  uint8_t magic_num[12];
  uint8_t product_id;
  uint8_t custom_id;
  uint8_t model_id;
  uint8_t sub_id;
  uint8_t new_version;
  uint8_t reserved[7];	
  uint32_t next_offs;
} frodo2_control_header_t;

// little-endian
typedef struct FRODOII_EXTEND_HEADER_ {
  char 	directory[32];
  char	filename[32];
  uint16_t chmod;
  uint8_t  execute;
  uint8_t  reserved[13];

  uint32_t offs;
  uint32_t len;
  uint32_t checksum;
  uint32_t next_offs;
} frodo2_extend_header_t;

#endif // FRODOII_H

